home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / system / mail / mailhand / metamail.z / metamail / bin / audiosend < prev    next >
Encoding:
Text File  |  1992-03-10  |  2.5 KB  |  100 lines

  1. #!/bin/csh -f
  2. # Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
  3. # Permission to use, copy, modify, and distribute this material 
  4. # for any purpose and without fee is hereby granted, provided 
  5. # that the above copyright notice and this permission notice 
  6. # appear in all copies, and that the name of Bellcore not be 
  7. # used in advertising or publicity pertaining to this 
  8. # material without the specific, prior written permission 
  9. # of an authorized representative of Bellcore.  BELLCORE 
  10. # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
  11. # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
  12. # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  13. #
  14.  
  15. # This is to make metamail/showaudio do playback on the speaker, not the phone.
  16. setenv AUDIOSPEAKERFORCE 1 
  17.  
  18. if (-d /usr/sony) then
  19.     set dev=/dev/sb0
  20. else
  21.     set dev=/dev/audio
  22. endif
  23.  
  24. echo -n "To: "
  25. set to = $<
  26. echo -n "Subject: "
  27. set subject = $<
  28. echo -n "CC: "
  29. set cc = $<
  30.  
  31. record:
  32. echo -n "Press RETURN when you are ready to start recording: "
  33. set foo = $<
  34.  
  35. set fname = /tmp/audio-out.$$
  36. set fnameraw = /tmp/audio-raw.$$
  37.  
  38. echo "To: " "$to" > $fname
  39. echo "Subject: " "$subject" >> $fname
  40. echo "CC: " "$cc" >> $fname
  41. echo "MIME-Version: 1.0" >> $fname
  42. echo "Content-Type: audio/basic" >> $fname
  43. echo "Content-Transfer-Encoding: base64" >> $fname
  44. echo  "" >> $fname
  45. # THIS IS UNBELIEVABLY GRUBBY
  46. onintr cleanup
  47. if (! $?RECORD_AUDIO) then
  48.     (/bin/cat < $dev > $fnameraw) &
  49. else
  50.     ($RECORD_AUDIO > $fnameraw) &
  51. endif
  52. jobs -l > /tmp/AUDCAT.$$
  53. set foo=`/bin/cat /tmp/AUDCAT.$$`
  54. /bin/rm /tmp/AUDCAT.$$
  55. set PID=$foo[2]
  56. echo -n "press RETURN when you are done recording: "
  57. set foo=$<
  58. echo One moment please...
  59. /bin/sleep 1
  60. echo -n Killing recording job...
  61. /bin/kill -9 $PID >& /dev/null
  62. /usr/local/bin/mmencode -b < $fnameraw >> $fname
  63. /bin/rm $fnameraw
  64. echo "" >> $fname
  65.  
  66. whatnext:
  67. echo ""
  68. echo "What do you want to do?"
  69. echo ""
  70. echo "1 -- Send mail"
  71. echo "2 -- Listen to recorded message"
  72. echo "3 -- Replace with a new recording"
  73. echo "4 -- Quit"
  74. set which = $<
  75.     switch ($which)
  76.         case 1:
  77.           echo -n "Sending mail, please wait...  "
  78.           /usr/lib/sendmail $to  $cc < $fname
  79.           if (! $status) then
  80.             echo "Done."
  81.             rm $fname
  82.             exit
  83.           else
  84.             echo Mail delivery failed, draft mail is in $fname
  85.           endif
  86.           breaksw
  87.         case 2:
  88.           metamail -d $fname
  89.           breaksw
  90.         case 3:
  91.           goto record
  92.         case 4:
  93.           exit
  94.     endsw
  95. goto whatnext
  96. exit 0
  97. cleanup:
  98. kill -9 $PID >& /dev/null
  99.